Reportgroupssummaryhandler Usage
Document Version v.2
Document Last Updated 2/3/2020
Software Version Documented v9.5.83

How/Why to use the ReportGroupsSummaryHandler to summarize totals

XtraReports does not support doing summary operations on group totals, for example if you have an invoice list with Grand Total field for each invoice, and as a child group we have all payments done for this invoice, now for the total of the report if you just did SUM(GrandTotal) it will cause the sum function to duplicate the GrandTotal of the invoice for all of its payments making the total off. They support custom events for this but it is very tedious and error prone since for each field you need to handle 3 events per group and make sure things are ordered correctly so you can reset the group total correctly, also that applies for adding custom summary functions like GM% or similar things.

Reasons to use ReportGroupsSummaryHandler:

Usage:

Example:

var summaryHandler = new Reporting.ReportGroupsSummaryHandler<int>(baseReport1, () => (int)GetCurrentColumnValue("OrderSys"));

summaryHandler .AddSummaryField(

()=> GetCurrentColumnValue("OrderTotal"),

() => new Reporting.SumAccumilator<decimal>()

).AddFieldLevels(new []{tableCell18});

}